import Vue from "vue";

export function httpClient(url) {
    return {
        index (filter = {}) {
            return Vue.axios.get(url, {
                params: filter
            });
        },
        show (id) {
            return Vue.axios.get(`${url}/${id}`);
        },
        store (data) {
            return Vue.axios.post(url, data);
        },
        update (data) {
            return Vue.axios.put(`${url}/${data.id}`, data);
        },
        destroy (id) {
            return Vue.axios.delete(`${url}/${id}`);
        },
        all() {
            return Vue.axios.get(`${url}/all`);
        }
    }
}
